//
//  BHFunDetailInfoCell.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/6/23.
//

import UIKit

class BHFunDetailInfoCell: UITableViewCell {

    @IBOutlet weak var name_label: UILabel!
    @IBOutlet weak var sportName_label: UILabel!
    
    @IBOutlet weak var area_distance_label: UILabel!
    
    @IBOutlet weak var start_time_label: UILabel!
    
    @IBOutlet weak var end_time_label: UILabel!
    
    
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.sportName_label.addLayerCorner(2, 0.5, .color_999999)
    }
    
    var model: BHFunDetailInfoModel! {
        didSet {
            self.name_label.text = model.name
            if BHLocationManager.shared.authed == true {
                self.area_distance_label.text = "\(model.distance)m \(model.areaName)"
            }else {
                self.area_distance_label.text = model.areaName
            }

            self.start_time_label.text = model.beginTime
            self.end_time_label.text = model.signupEndTime
            
            if model.typeOneLabel.isEmpty == true && model.typeTwoLabel.isEmpty == true {
                self.sportName_label.isHidden = true
            }else {
                self.sportName_label.isHidden = false
                if model.typeTwoLabel.isEmpty == true {
                    self.sportName_label.text = " \(model.typeOneLabel)   "
                }else {
                    self.sportName_label.text = " \(model.typeTwoLabel)   "
                }
            }
        }
    }
    
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    static var cellHeight: CGFloat {
        get {
            return 181
        }
    }
    
}
